package com.helmlabs.grouper.finance.model;

import java.util.List;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.CollectionOfElements;

@Entity
public class MembershipDueRate {
	
	private Long id;
	private String name;
	private double amount;
	private Set<String> appliesToGroups;
	private MembershipDueSchedule schedule;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public double getAmount() {
		return amount;
	}
	public void setAmount(double amount) {
		this.amount = amount;
	}
	@ManyToOne (fetch=FetchType.EAGER)
	@JoinColumn(name="schedule_id")
	public MembershipDueSchedule getSchedule() {
		return schedule;
	}
	public void setSchedule(MembershipDueSchedule schedule) {
		this.schedule = schedule;
	}
	@CollectionOfElements (fetch=FetchType.EAGER)
	public Set<String> getAppliesToGroups() {
		return appliesToGroups;
	}
	public void setAppliesToGroups(Set<String> appliesToGroups) {
		this.appliesToGroups = appliesToGroups;
	}
	
	public String toString(){
		return super.toString() + "{name=" + getName() + ",amount=" + getAmount() + ",appliesToGroups=" + getAppliesToGroups() + "}";
	}

}
